package org.serverct.finalfight.game.listener.player;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.serverct.finalfight.game.GameManager;
import org.serverct.finalfight.internal.game.basic.BasicGame;

public class LogoutListener implements Listener {
    @EventHandler
    public void onQuit(PlayerQuitEvent event) {
        Player player = event.getPlayer();
        BasicGame game = GameManager.getGame(player);
        if (game == null) {
            return;
        }
        game.quit(player, true);
    }
}
